﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Dungeon_Dive
{
    /// <summary>
    /// Screen for pause menu.
    /// </summary>
    public class PauseMenuScreen : GameScreen
    {
        SpriteBatch sb;
        SpriteFont font;

        Log log;

        public Menu PauseMenu { get; private set; }

        public PauseMenuScreen(Game1 game)
            : base(game)
        {
            PauseMenu = new Menu(game);
            PauseMenu.AddItem("Resume Game");
            PauseMenu.AddItem("Help");
            PauseMenu.AddItem("Save and Quit");
            components.Add(PauseMenu);

        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            log = (Log)parentGame.Services.GetService(typeof(Log));
            log.Write("PauseMenuScreen.Init()");
            base.Initialize();
        }

        protected override void LoadContent()
        {
            log.Write("PauseMenuScreen.LoadContent()");
            ContentManager contentManager = (ContentManager)parentGame.Services.GetService(typeof(ContentManager));
            sb = contentManager.SpriteBatch;
            font = parentGame.Content.Load<SpriteFont>("Fonts\\Debugfont");
            base.LoadContent();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            sb.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.BackToFront,
                SaveStateMode.SaveState);
            sb.DrawString(font, "Game Paused", new Vector2(100, 100), Color.White);
            sb.End();

            PauseMenu.Draw(gameTime);

            base.Draw(gameTime);
        }
    }
}